/**
 * 产品相关接口
 */
import { request } from '../configs';

import makeApi from './index';

export const defaultData = {
	query: {
		searchCount: true,
		openSort: true,
		isAsc: false,
		orderByField: 'utime',
		size: 1000
	}
};

const api = {
	query: '/product/product/page',
	create: '/product/product/add',
	update: '/product/product/update',
	remove: '/product/product/delete',
	detail: '/product/product/detail',
	pull: '/product/product/pull',
	getCategoryAndManufacturer: '/product/product/add',
	productCommandQuery: '/product/productCommandConfig/list',
	addProductCommand: '/product/productCommandConfig/add',
	updateProductCommand: '/product/productCommandConfig/update',
	deleteProductCommand: '/product/productCommandConfig/delete',
	operationHistory: '/product/productOperationHistory/list',
	thirdAdd: '/product/productDataPointExtController/add',
	thirdDel: '/product/productDataPointExtController/delete',
	thirdUpdate: '/product/productDataPointExtController/update',
	thirdQuery: '/product/productDataPointExtController/query',
};

const services = makeApi(api);

services.getCategoryAndManufacturer = function getCategoryAndManufacturer(params) {
	return request({
		url: api.getCategoryAndManufacturer,
		method: 'get',
		data: params,
	});
};

const {
	pull,
	query,
	create,
	update,
	remove,
	detail,
	thirdAdd,
	thirdDel,
	thirdUpdate,
	thirdQuery,
	getCategoryAndManufacturer,
	productCommandQuery,
	addProductCommand,
	updateProductCommand,
	deleteProductCommand,
	operationHistory,
} = services;

export {
	pull,
	query,
	create,
	update,
	remove,
	detail,
	thirdAdd,
	thirdDel,
	thirdQuery,
	thirdUpdate,
	operationHistory,
	addProductCommand,
	productCommandQuery,
	updateProductCommand,
	deleteProductCommand,
	getCategoryAndManufacturer,
};
export default services;
